home *** CD-ROM | disk | FTP | other *** search
- Files in this zip file:
- -----------------------
-
- READ.ME this description file
- COMMA.OBJ MicroSoft FORTRAN 5.1 compiled object file
- TESTCOMM.FOR Test program to show how COMMA works
- COMMA.MAK Makefile to show how to compile & link TESTCOMM.FOR
-
-
- Description:
- ------------
-
- COMMA is a FORTRAN character function that is used to embed commas,
- and other special print characters, into your printouts. For example,
- the number 12345678.000000 could be printed as "12,345,678" (quotes
- would not appear) or as "$12,345,678.00" or as "12,345,678.0%".
- The number 0.00 could be printed as "0","0.00"," -","NA", or " " (blank).
-
- How to Use:
- -----------
-
- The following simple program shows how to use the COMMA function:
-
- DOUBLE PRECISION DX(3)
- REAL X(3)
- INTEGER N(3)
- CHARACTER*20 COMMA (1)
- DX(1)=1234.33333
- DX(2)=0.0
- DX(3)=1.0
- WRITE(*,100) (COMMA(DX(I),10,1,1,2),I=1,3) (2)
- X(1)=1234.33333
- X(2)=0.0
- X(3)=1.0
- WRITE(*,100) (COMMA(DBLE(X(I)),10,1,1,2),I=1,3) (3)
- N(1)=1234
- N(2)=0
- N(3)=1
- WRITE(*,100) (COMMA(DBLE(N(I)),10,1,1,2),I=1,3) (3)
- 100 FORMAT(1X,3A10) (4)
- STOP
- END
-
- Output from above program would be:
- $1,234.3 NA $1.0
- $1,234.3 NA $1.0
- $1,234.0 NA $1.0
-
- (1) In any routine (mainline, subroutine or function) that calls
- COMMA, it must be defined as a CHARACTER*20 variable.
-
- (2) The arguments for COMMA are as follows:
-
- CHARACTER*20 FUNCTION COMMA(RRIN,LN,NDEC1,NP,NN1)
-
- RRIN: NUMBER TO BE CONVERTED (DOUBLE PRECISION)
- LN: LENGTH OF THE OUTPUT FIELD (INTEGER)
- NDEC1: NUMBER OF DECIMAL PLACES TO BE DISPLAYED (INTEGER)
- NP: SPECIAL CHARACTER FLAG (INTEGER)
- 0 = NO SPECIAL CHARACTER
- 1 = PREFIX OUTPUT STRING WITH DOLLAR SIGN ($)
- 2 = SUFFIX OUTPUT STRING WITH PERCENT SIGN (%)
- NN1: ZERO FILL FLAG (INTEGER)
- 0 = PRINT ZEROS
- 1 = CHANGE ZEROS TO A DASH (-)
- 2 = CHANGE ZEROS TO NOT APPLICABLE (NA)
- 3 = CHANGE ZEROS TO BLANKS
-
- (3) Real (single precision) and integers need to be converted
- to double precision using the DBLE() intrinsic function.
-
- (4) The FORMAT statement requires character print fields of the
- same length as specified in the call to COMMA.
-
- THIS IS SHAREWARE!
- ------------------
-
- If you intend to use this routine for any business purpose, please
- register by sending $10.00 to:
-
- Peter Robertshaw
- 6430 Breezewood Ct.
- Orangevale, CA 95662
-
- For your registration you will receive peace of mind, plus a disk with
- the FORTRAN code on it (or I will E-mail to code to your COMPUSERVE or
- INTERNET address). This will allow you to use the routine with
- other FORTRAN compilers and on other platforms. So far I have
- successfully used it on PC's (using MS FORTRAN and LAHEY FORTRAN),
- and on IBM mainframes, DEC VAX's, and UNIX based systems (SUN work-
- station and ALLIANT supercomputer).